<?php
$body.="<div>
			<table cellpadding='5' cellspacing='0' style='text-align:center; border:1px solid #C4C0C9; width:100%; border-bottom:none; border-right:none'>
		    	<tr>
		        	<td style='width:150px;border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_title."</td>
		            <td colspan='3' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$dtitle."</td>            
		        </tr>
		        <tr>
		        	<td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_description."</td>
		            <td colspan='3' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$ddescription."</td>            
		        </tr>
		        <tr>
		        	<td width='15%' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_created_date."</td>            
		            <td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$dtime."</td>
		            <td  width='15%' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_writer."</td>
		            <td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$duser."</td>
		        </tr>       
		        <tr>
		        	<td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_approver."</td>
		            <td colspan='3' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:1px; text-align:center;'>
		                <table cellpadding='5' cellspacing='0' style='text-align:center; border:1px solid #C4C0C9; width:100%; border-bottom:none; border-right:none'>";
                    				
                    				$i=1;
                    				while ($row = mysql_fetch_array($query1))
                    				{
                    					$dnameapprover = $row[Fullname];
                    					$ddateapproved = $row[DateApprove];
                    					$dcommentm=$row[Description];
                    					$didEmployee=$row[IDEmployee];
                    					if ($row[IDStatus] == 1){
	                    					$dstatus=$l_status_complete;
	                    				} else if ($row[IDStatus] == 2){
	                    					$dstatus=$l_status_pending;
	                    				}else if ($row[IDStatus] == 3){
	                    					$dstatus=$l_status_declined;
	                    				}else if ($row[IDStatus] == 4){
	                    					$dstatus=$l_status_saved;
	                    				}else if ($row[IDStatus] == 5){
	                    					$l_status_reference;
	                    				}
		                
		           $body.=" <tr>
		                        <td width='100px' rowspan='2' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:blue; height:36px; padding:4px; text-align:center;'>".$l_step." ".$i."</td>
		                        <td width='450px' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center;'>
		                        	<span style='display: block;'>
		                    					<b>".$dnameapprover."</b>_".$dstatus." ".$ddateapproved."
		                    		</span>
		                        </td>            
		                        <td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center;'><div align='left'>".$l_reference." :"; 
		                      	//Get list references
                    				$query2 = mysql_query("SELECT e.Fullname,e.Email,e.IDEmployee FROM list_reference l , employee e 
 														WHERE l.id_group = '$idgroupapprove' AND l.id_manager='$didEmployee' AND l.id_employee=e.IDEmployee;") ;
		                    				$refer=array();
		                    				while ($row1 = mysql_fetch_array($query2))
		                    				{
		                    					$refer[]=array($row1[Fullname],$row1[Email],$row1[IDEmployee]);
		                    					$dnamereferences = $row1[Fullname];
		                       					$body.="<b>".$dnamereferences."</b>;";
		                        
		                    				}
		                    $body.=" </div></td></tr>";
		                    if($ddateapproved !=null){
		                    $body.=" <tr>
		                      	<td colspan='2' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center;'><div align='left'><strong>".$l_comment." :</strong> ".$dcommentm."</div></td>
		                    	</tr>";
		                    }else{
		                    	$body.=" <tr>
		                    	</tr>";
		                    }
	                    $i++;
	                    }
		                    
			$body.=" </table> 
			
		            </td>             
		        </tr>
		        <tr>
		        	<td width='15%' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_employee_performent."</td>            
		            <td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$dperforment."</td>
		            <td  width='15%' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_trip_date."</td>
		            <td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$dtripDate."</td>
		        </tr>    
		        <tr>
		        	<td width='15%' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_location."</td>            
		            <td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$dlocation."</td>
		            <td  width='15%' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_total_time."</td>
		            <td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$dtotalTime."</td>
		        </tr>    
		        <tr>
		          <td colspan='4' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:1px; text-align:left;height: 300px;vertical-align: top;'>
		          	".$dcontent."
		          </td>
		        </tr>
		        <tr>
		        	<td style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:center; font-weight:bold; background:#eee'>".$l_comment."</td>
		            <td colspan='3' style='border-bottom:1px solid #c4c0c9; border-right:1px solid #c4c0c9; color:#333; height:36px; padding:4px; text-align:left;'>".$dcomment."</td>            
		        </tr>
		    </table>
		</div>";


?>